1 <?php
2  session_start();
3  
if(isset($_SESSION['user']))
4  {
5  }
6  
else{
7   echo
"<script>location.href='login.html'</script>";
8  }
9 ?>
10 <html>
11     <head>
12         <title>Animals </title>
13         <style>
14 body {
15   margin:
0;
16   font-family: Arial, Helvetica, sans-serif;
17   background: #
484848;
18   }
19 .topnav {
20   overflow: hidden;
21   background-color: #4CAF50;
22   height: 70px;
23   border: 3px solid green;
24 }
25
26 .topnav a {
27   
float: left;
28   color: #f2f2f2;
29   text-align: center;
30   padding: 14px 16px;
31   text-decoration: none;
32   font-size: 35px;
33   font-weight: bold;
34
35 }
36
37 .topnav-right {
38   
float: right;
39 }
40 table {
41     font-family: arial, sans-serif;
42     border-collapse: collapse; outline: green solid 5px;
43     background: #FAFAFA;
44     margin:5px ;
45     width:
100%;
46 }
47
48 td, th {
49     border: 2px solid #dddddd;
50     text-align: left;
51     padding: 8px;
52 }
53 th{
54   background-color: #4CAF50;
55 }
56
57
58 .custombutton{
59   margin:25px;
60   
61 }input[type=text] {
62     width:
15%;
63     padding: 12px 20px;
64     margin: 8px ;
65     background:transparent;
66     border: 2px solid red;
67     color:#f2f2f2;
68 }
69
70
71         </style>
72 </head>
73 <body>
74 <div
class="topnav">
75             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
76             <a href=
"animals.php">Animals</a>
77             <div
class="topnav-right">
78               <a href=
"logout.php">logout</a>
79             </div>
80           </div>
81  <div
class="custombutton">
82 <form>
83 <button style=
" height: 50px;width: 150px;cursor:pointer;border-radius:15px;
84 border: 3px solid green;background-color: #4CAF50;color:#f2f2f2;font-size:17px;"
formaction="animalsadd.php">Add new
85
86 animal</button>
87
88 <button style=
"margin-left:900px; height: 50px;width: 150px;cursor:pointer;border-radius:15px;
89 border: 3px solid green;background-color: #4CAF50;color:#f2f2f2;font-size:17px;"

90
91 formaction=
"animalsupdate.php">update animal</button>
92 </form>
93 </div>
94     <?php
95    
96 $con = mysqli_connect(
"localhost","root","","Petshop_management");
97 if
(!$con)
98 {
99 die(
"could not connect".mysql_error());
100 }
101 $
var=mysqli_query($con,"select P.pet_id,P.pet_category,A.breed,A.weight,A.height,A.age,fur,P.cost from pets P,animals
102
103 A
where P.pet_id=A.pet_id ");
104 echo
"<table border size=10>";
105 echo
"<tr>
106 <th>pet_ID</th>
107 <th>petcategory</th>
108 <th>breed</th>
109 <th>weight(kg)</th>
110 <th>height(cm)</th>
111 <th>age(m)</th>
112 <th>fur</th>
113 <th>cost(Rs)</th>
114 </tr>"
;
115 if
(mysqli_num_rows($var)>0){
116     
while($arr=mysqli_fetch_row($var))
117     { echo
"<tr>
118     <td>$arr[
0]</td>
119     <td>$arr[
1]</td>
120     <td>$arr[
2]</td>
121     <td>$arr[
3]</td>
122     <td>$arr[
4]</td>
123     <td>$arr[
5]</td>
124     <td>$arr[
6]</td>
125     <td>$arr[
7]</td>
126     </tr>"
;}
127     echo
"</table>";
128     mysqli_free_result($
var);
129 }
130
131 mysqli_close($con);
132     
133     
134 ?>
135
136 <div
class="lastblock" style="margin-top:25px;">
137 <form action=
"deleteanimal.php" method="post">
138     <input id=
"dbutton" type="text" name="t1" placeholder="Enter the id to delete" required>
139     <input style=
"width:75px;height:44px;cursor:pointer;border-radius:15px;
140 border: 3px solid green;background-color: #4CAF50;color:#f2f2f2;font-size:17px;"
type="submit" value="Delete">
141 </form>
142 </div>
143 </body>
144 </html>


Gõ tìm kiếm nhanh...